home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / PCI.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  7.2 KB  |  243 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        PCI.h
  3.  
  4.      Contains:    PCI Bus Interfaces.
  5.  
  6.      Version:    Technology:    PowerSurge 1.0.2
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1993-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __PCI__
  18. #define __PCI__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __NAMEREGISTRY__
  25.     #include <NameRegistry.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. /* Definitions for the PCI Config Registers*/
  52. enum {
  53.     kPCIConfigVendorID            = 0x00,
  54.     kPCIConfigDeviceID            = 0x02,
  55.     kPCIConfigCommand            = 0x04,
  56.     kPCIConfigStatus            = 0x06,
  57.     kPCIConfigRevisionID        = 0x08,
  58.     kPCIConfigClassCode            = 0x09,
  59.     kPCIConfigCacheLineSize        = 0x0C,
  60.     kPCIConfigLatencyTimer        = 0x0D,
  61.     kPCIConfigHeaderType        = 0x0E,
  62.     kPCIConfigBIST                = 0x0F,
  63.     kPCIConfigBaseAddress0        = 0x10,
  64.     kPCIConfigBaseAddress1        = 0x14,
  65.     kPCIConfigBaseAddress2        = 0x18,
  66.     kPCIConfigBaseAddress3        = 0x1C,
  67.     kPCIConfigBaseAddress4        = 0x20,
  68.     kPCIConfigBaseAddress5        = 0x24,
  69.     kPCIConfigCardBusCISPtr        = 0x28,
  70.     kPCIConfigSubSystemVendorID    = 0x2C,
  71.     kPCIConfigSubSystemID        = 0x2E,
  72.     kPCIConfigExpansionROMBase    = 0x30,
  73.     kPCIConfigCapabilitiesPtr    = 0x34,
  74.     kPCIConfigInterruptLine        = 0x3C,
  75.     kPCIConfigInterruptPin        = 0x3D,
  76.     kPCIConfigMinimumGrant        = 0x3E,
  77.     kPCIConfigMaximumLatency    = 0x3F
  78. };
  79.  
  80. /* Definitions for the Capabilities PCI Config Register*/
  81. enum {
  82.     kPCICapabilityIDOffset        = 0x00,
  83.     kPCINextCapabilityOffset    = 0x01,
  84.     kPCIPowerManagementCapability = 0x01,
  85.     kPCIAGPCapability            = 0x02
  86. };
  87.  
  88. /* Types and structures for accessing the PCI Assigned-Address property.*/
  89.  
  90. #define kPCIAssignedAddressProperty "assigned-addresses"
  91. enum {
  92.     kPCIRelocatableSpace        = 0x80,
  93.     kPCIPrefetchableSpace        = 0x40,
  94.     kPCIAliasedSpace            = 0x20,
  95.     kPCIAddressTypeCodeMask        = 0x03,
  96.     kPCIConfigSpace                = 0,
  97.     kPCIIOSpace                    = 1,
  98.     kPCI32BitMemorySpace        = 2,
  99.     kPCI64BitMemorySpace        = 3
  100. };
  101.  
  102. typedef UInt8                             PCIAddressSpaceFlags;
  103. enum {
  104.     kPCIDeviceNumberMask        = 0x1F,
  105.     kPCIFunctionNumberMask        = 0x07
  106. };
  107.  
  108. typedef UInt8                             PCIDeviceFunction;
  109. typedef UInt8                             PCIBusNumber;
  110. typedef UInt8                             PCIRegisterNumber;
  111.  
  112. struct PCIAssignedAddress {
  113.     PCIAddressSpaceFlags             addressSpaceFlags;
  114.     PCIBusNumber                     busNumber;
  115.     PCIDeviceFunction                 deviceFunctionNumber;
  116.     PCIRegisterNumber                 registerNumber;
  117.     UnsignedWide                     address;
  118.     UnsignedWide                     size;
  119. };
  120. typedef struct PCIAssignedAddress        PCIAssignedAddress;
  121. typedef PCIAssignedAddress *            PCIAssignedAddressPtr;
  122. #define GetPCIIsRelocatable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIRelocatableSpace)
  123. #define GetPCIIsPrefetchable( AssignedAddressPtr )        ((AssignedAddressPtr)->addressSpaceFlags & kPCIPrefetchableSpace)
  124. #define GetPCIIsAliased( AssignedAddressPtr )            ((AssignedAddressPtr)->addressSpaceFlags & kPCIAliasedSpace)
  125. #define GetPCIAddressSpaceType( AssignedAddressPtr )    ((AssignedAddressPtr)->addressSpaceFlags & kPCIAddressTypeCodeMask)
  126. #define GetPCIBusNumber( AssignedAddressPtr )            ((AssignedAddressPtr)->busNumber)
  127. #define GetPCIDeviceNumber( AssignedAddressPtr )        (((AssignedAddressPtr)->deviceFunctionNumber >> 3) & kPCIDeviceNumberMask)
  128. #define GetPCIFunctionNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->deviceFunctionNumber & kPCIFunctionNumberMask)
  129. #define GetPCIRegisterNumber( AssignedAddressPtr )        ((AssignedAddressPtr)->registerNumber)
  130.  
  131.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  132.                                                                                             #pragma parameter __D0 EndianSwap16Bit(__D0)
  133.                                                                                             #endif
  134. EXTERN_API( UInt16 )
  135. EndianSwap16Bit                    (UInt16                 data16)                                ONEWORDINLINE(0xE158);
  136.  
  137.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  138.                                                                                             #pragma parameter __D0 EndianSwap32Bit(__D0)
  139.                                                                                             #endif
  140. EXTERN_API( UInt32 )
  141. EndianSwap32Bit                    (UInt32                 data32)                                THREEWORDINLINE(0xE158, 0x4840, 0xE158);
  142.  
  143. EXTERN_API( OSErr )
  144. ExpMgrConfigReadByte            (RegEntryIDPtr             node,
  145.                                  LogicalAddress         configAddr,
  146.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0620, 0xAAF3);
  147.  
  148. EXTERN_API( OSErr )
  149. ExpMgrConfigReadWord            (RegEntryIDPtr             node,
  150.                                  LogicalAddress         configAddr,
  151.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0621, 0xAAF3);
  152.  
  153. EXTERN_API( OSErr )
  154. ExpMgrConfigReadLong            (RegEntryIDPtr             node,
  155.                                  LogicalAddress         configAddr,
  156.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0622, 0xAAF3);
  157.  
  158. EXTERN_API( OSErr )
  159. ExpMgrConfigWriteByte            (RegEntryIDPtr             node,
  160.                                  LogicalAddress         configAddr,
  161.                                  UInt8                     value)                                THREEWORDINLINE(0x303C, 0x0523, 0xAAF3);
  162.  
  163. EXTERN_API( OSErr )
  164. ExpMgrConfigWriteWord            (RegEntryIDPtr             node,
  165.                                  LogicalAddress         configAddr,
  166.                                  UInt16                 value)                                THREEWORDINLINE(0x303C, 0x0524, 0xAAF3);
  167.  
  168. EXTERN_API( OSErr )
  169. ExpMgrConfigWriteLong            (RegEntryIDPtr             node,
  170.                                  LogicalAddress         configAddr,
  171.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x0625, 0xAAF3);
  172.  
  173. EXTERN_API( OSErr )
  174. ExpMgrIOReadByte                (RegEntryIDPtr             node,
  175.                                  LogicalAddress         ioAddr,
  176.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0626, 0xAAF3);
  177.  
  178. EXTERN_API( OSErr )
  179. ExpMgrIOReadWord                (RegEntryIDPtr             node,
  180.                                  LogicalAddress         ioAddr,
  181.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0627, 0xAAF3);
  182.  
  183. EXTERN_API( OSErr )
  184. ExpMgrIOReadLong                (RegEntryIDPtr             node,
  185.                                  LogicalAddress         ioAddr,
  186.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0628, 0xAAF3);
  187.  
  188. EXTERN_API( OSErr )
  189. ExpMgrIOWriteByte                (RegEntryIDPtr             node,
  190.                                  LogicalAddress         ioAddr,
  191.                                  UInt8                     value)                                THREEWORDINLINE(0x303C, 0x0529, 0xAAF3);
  192.  
  193. EXTERN_API( OSErr )
  194. ExpMgrIOWriteWord                (RegEntryIDPtr             node,
  195.                                  LogicalAddress         ioAddr,
  196.                                  UInt16                 value)                                THREEWORDINLINE(0x303C, 0x052A, 0xAAF3);
  197.  
  198. EXTERN_API( OSErr )
  199. ExpMgrIOWriteLong                (RegEntryIDPtr             node,
  200.                                  LogicalAddress         ioAddr,
  201.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x062B, 0xAAF3);
  202.  
  203. EXTERN_API( OSErr )
  204. ExpMgrInterruptAcknowledgeReadByte (RegEntryIDPtr         entry,
  205.                                  UInt8 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0411, 0xAAF3);
  206.  
  207. EXTERN_API( OSErr )
  208. ExpMgrInterruptAcknowledgeReadWord (RegEntryIDPtr         entry,
  209.                                  UInt16 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0412, 0xAAF3);
  210.  
  211. EXTERN_API( OSErr )
  212. ExpMgrInterruptAcknowledgeReadLong (RegEntryIDPtr         entry,
  213.                                  UInt32 *                valuePtr)                            THREEWORDINLINE(0x303C, 0x0413, 0xAAF3);
  214.  
  215. EXTERN_API( OSErr )
  216. ExpMgrSpecialCycleWriteLong        (RegEntryIDPtr             entry,
  217.                                  UInt32                 value)                                THREEWORDINLINE(0x303C, 0x0419, 0xAAF3);
  218.  
  219. EXTERN_API( OSErr )
  220. ExpMgrSpecialCycleBroadcastLong    (UInt32                 value)                                THREEWORDINLINE(0x303C, 0x021A, 0xAAF3);
  221.  
  222.  
  223. #if PRAGMA_STRUCT_ALIGN
  224.     #pragma options align=reset
  225. #elif PRAGMA_STRUCT_PACKPUSH
  226.     #pragma pack(pop)
  227. #elif PRAGMA_STRUCT_PACK
  228.     #pragma pack()
  229. #endif
  230.  
  231. #ifdef PRAGMA_IMPORT_OFF
  232. #pragma import off
  233. #elif PRAGMA_IMPORT
  234. #pragma import reset
  235. #endif
  236.  
  237. #ifdef __cplusplus
  238. }
  239. #endif
  240.  
  241. #endif /* __PCI__ */
  242.  
  243.